#ifndef DAUPROXY_CLIENT_DAUPROXYAPI_H
#define DAUPROXY_CLIENT_DAUPROXYAPI_H
#include "dauSproxy.h"
namespace dauproxy_api_func
{
    /**
     * Defines all api function types for libdauproxy.so. These types define in here because we are use dynamic linker
     * loader for loading libdauproxy.so. You can check the dauproxy.h file for more details about api documentation.
     * */

    typedef int (*ProxySetLibraryPath)(char* _lib_path);
    typedef int (*ProxyInitLibrary)();
    typedef int (*ProxyReleaseLibrary)();
    typedef int (*ProxyCreateDevice)(char* dev_id, int* dev_id_len,struct _server_dev_info_plus* devInfo, bool singleChannel);
    typedef int (*ProxyAddDeviceChannelInfoPlus)(char* dev_id, char* channelId, char* stream_id, int source_num, int mediaChannel);
    typedef int (*ProxyDelDeviceChannelInfo)(char* dev_id, char* channelId,char* stream_id);
    typedef int (*ProxySetChannelMediaInfo)(char* dev_id, struct _channel_media_info_plus* mediainfo);
    typedef int (*ProxyStartServer)(char* dev_id);
    typedef int (*ProxyDestroyDevice)(char* dev_id);
    typedef int (*ProxySetChannelName)(char* dev_id, char* channelId,char* channel_name);
    typedef int (*ProxyRegisterPTZCB)(char* dev_id, PTZCallBackDAU CBFunPtr, void* pUser);
    typedef int (*ProxyRegisterRecCB)(char* dev_id, RECCallBackDAU errorinfocb, void* pUser);

    typedef int (*ProxyModifyRecChannelInfo)(char* dev_id, char* channelId, char* stream_id, int rec_source_num, int channel_num, bool hasRec);
    typedef int (*ProxyModifyDeviceDescover)(char* dev_id, bool openDescover);
    typedef int (*ProxyModifyDeviceInfo)(char* dev_id, struct _server_dev_info_plus* devInfo);
}

class DauProxyApi
{
private:
    DauProxyApi();
    ~DauProxyApi();
    void *pHandle;
public:
    dauproxy_api_func::ProxySetLibraryPath ProxySetLibraryPath;
    dauproxy_api_func::ProxyInitLibrary ProxyInitLibrary;
    dauproxy_api_func::ProxyReleaseLibrary ProxyReleaseLibrary;

    dauproxy_api_func::ProxyCreateDevice ProxyCreateDevice;
    dauproxy_api_func::ProxyAddDeviceChannelInfoPlus ProxyAddDeviceChannelInfoPlus;
    dauproxy_api_func::ProxyDelDeviceChannelInfo ProxyDelDeviceChannelInfo;
    dauproxy_api_func::ProxySetChannelMediaInfo ProxySetChannelMediaInfo;
    dauproxy_api_func::ProxyStartServer ProxyStartServer;
    dauproxy_api_func::ProxyDestroyDevice ProxyDestroyDevice;
    dauproxy_api_func::ProxySetChannelName ProxySetChannelName;
    dauproxy_api_func::ProxyRegisterPTZCB ProxyRegisterPTZCB;
    dauproxy_api_func::ProxyRegisterRecCB ProxyRegisterRecCB;
    dauproxy_api_func::ProxyModifyRecChannelInfo ProxyModifyRecChannelInfo;
    dauproxy_api_func::ProxyModifyDeviceDescover ProxyModifyDeviceDescover;
    dauproxy_api_func::ProxyModifyDeviceInfo ProxyModifyDeviceInfo;
public:
    static DauProxyApi* GetInstance();
    int Init();
};

#endif //DAUPROXY_CLIENT_DAUPROXYAPI_H
